import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm'

import { SysRoleEntity } from '.'
import { BaseEntity } from './base.entity'

@Entity()
export class SysMenuEntity extends BaseEntity implements ISysMenuEntity {
  @PrimaryGeneratedColumn({ type: 'bigint' })
  menuId: string

  @Column()
  menuName: string

  @Column({ type: 'bigint' })
  parentId: string

  @Column()
  orderNum: number

  @Column()
  path: string

  @Column()
  component: string

  @Column()
  redirect: string

  @Column()
  isFrame: number

  @Column()
  isCache: number

  @Column()
  menuType: string

  @Column()
  visible: string

  @Column()
  status: string

  @Column()
  perms: string

  @Column()
  icon: string

  @Column()
  remark: string

  @ManyToMany(type => SysRoleEntity, role => role.menus)
  roles: SysRoleEntity[]
}
